# -*- encoding: utf-8 -*-
from django.shortcuts import render_to_response, get_list_or_404,\
    get_object_or_404
from galeria.models import Album,Imagem
from django.conf import settings
from django.template.context import RequestContext

def ListarAlbuns(request):
    albuns = get_list_or_404(Album.objects.all())
    return render_to_response('galeria/index.html', {'albuns':albuns},context_instance=RequestContext(request))


def obterPorSlug(request,album_slug):
    album = get_object_or_404(Album, slug=album_slug)
    imagens = get_list_or_404(Imagem.objects.filter(album=album))
    return render_to_response('galeria/fotos.html', {'imagens':imagens, 'album':album},context_instance=RequestContext(request))


